package com.chenjj.bigdata.spark.scala.simple

import org.apache.spark.{SparkConf, SparkContext}

object filterOperator {
  def main(args: Array[String]): Unit = {
    val conf = new SparkConf()
      .setAppName("WordCountLocal")
      .setMaster("local")
      .set("spark.testing.memory", "1024000000")
    val sc = new SparkContext(conf)

    val a = sc.parallelize(1 to 10)
    a.filter(_%2 ==0).collect().foreach(println) //找偶数
    a.filter(_ < 4).collect().foreach(x=>{println(x)})//找小于4的数
    a.map(_*2).filter(_<4).collect().foreach(x=>{println(x)})//找乘以2以后还小于4的数

  }
}
